package com.xzy.shop.web.servlet;

import com.xzy.shop.domain.Address;
import com.xzy.shop.domain.User;
import com.xzy.shop.service.AddressService;
import com.xzy.shop.service.impl.AddressServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/address/*")
public class AddressServlet extends BaseServlet {
    AddressService service = new AddressServiceImpl();
    public void findByUid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        User user = (User) request.getSession().getAttribute("loginUser");
        List<Address> list = service.findByUid(user.getUid() + "");

        writeValue(list, response);
    }
}
